package com.zkthink.ceres.finance.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zkthink.base.R;
import com.zkthink.base.controller.SuperController;
import com.zkthink.base.request.PageParams;
import com.zkthink.ceres.finance.dto.*;
import com.zkthink.ceres.finance.entity.DepositJournal;
import com.zkthink.ceres.finance.service.DepositJournalService;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import com.zkthink.ceres.finance.service.JournalDetailService;
import com.zkthink.log.annotation.SysLog;
import com.zkthink.security.annotation.PreAuth;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * <p>
 * 前端控制器
 *
 * 保证金交易流水
 * </p>
 *
 * @author vivi.huang
 * @date 2020-06-26
 */
@Slf4j
@Validated
@RestController
@RequestMapping("/depositJournal")
@Api(value = "DepositJournal", tags = "保证金流水表")
//@PreAuth(replace = "depositJournal:")
@AllArgsConstructor
public class DepositJournalController  {

    private DepositJournalService depositJournalService;

    /**
     * 保证金交易流水分页查询
     *
     * @param params
     * @return
     */
    @ApiOperation(value = "列表查询")
    @PostMapping(value = "/page")
    @SysLog(value = "'分页列表查询:第' + #params?.current + '页, 显示' + #params?.size + '行'", response = false)
//    @PreAuth("hasPermit('{}view')")
    public R<IPage<DepositJournalDTO>> findDepositJournalPage(@RequestBody @Validated PageParams<DepositJournalPageDTO> params) {
        return depositJournalService.findDepositJournalPage(params);
    }


    /**
     * 保证金总金额
     *
     * @return
     */
    @ApiOperation(value = "保证金总金额")
    @PostMapping(value = "/summary")
    @SysLog(value = "", response = false)
//    @PreAuth("hasPermit('{}view')")
    public R<DepositSummaryDTO> getDepositSummary() {
        return depositJournalService.getDepositSummary();
    }









}
